﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
public partial class uc_breadcrumb : System.Web.UI.UserControl
{
    string Html = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {        
        if (!IsPostBack)
        {
            StringBuilder Html = new StringBuilder();
            Html.Append("<div class=\"endheader\"></div>");            
            //Html.Append(
            //    "<div id=\"pathway\">\n" +
            //    "	<ul>\n" +
            //    "		<li class=\"homepage\"><a href=\""+DAL.EnvInfo.HttpRoot+"home.html\">Home</a></li>\n");
            //if (Request.QueryString["cid"] != null)
            //{
            //    string RootCateUrl = string.Empty;
            //    int ParentID = 0;
            //    try
            //    {
            //        ParentID = int.Parse("0" + new CmsBLL().Category_GetParentIDByCateID(int.Parse("0" + Request.QueryString["cid"].ToString())));
            //    }
            //    catch{}
            //    if (ParentID > 0)
            //        RootCateUrl = "		<li><a href=\"" + DAL.Screen.BuildUrlForProductByCategory(new CmsBLL().Category_GetTitle(ParentID), ParentID.ToString(), CommonBLL.SiteID) + "\">" + new CmsBLL().Category_GetTitle(ParentID) + "</a></li>\n";
            //    if (Request.QueryString["pid"] != null)
            //    {
            //        Html.Append(
            //            RootCateUrl +
            //    "		<li><a href=\"" + DAL.Screen.BuildUrlForProductByCategory(new CmsBLL().Category_GetTitle(int.Parse("0" + Request.QueryString["cid"].ToString())), Request.QueryString["cid"].ToString(), CommonBLL.SiteID) + "\">" + new CmsBLL().Category_GetTitle(int.Parse("0" + Request.QueryString["cid"].ToString())) + "</a></li>\n" +
            //    "		<li><a href=\"" + DAL.Screen.BuildUrlForProductDetails(Request.QueryString["pid"].ToString(), new CmsBLL().Products_GetTitle(Request.QueryString["pid"].ToString()), Request.QueryString["cid"].ToString(), CommonBLL.SiteID) + "\">" + new CmsBLL().Products_GetTitle(Request.QueryString["pid"].ToString()) + "</a></li>\n");
            //    }
            //    else
            //    {
            //        Html.Append(
            //            RootCateUrl +
            //    "		<li><a href=\"" + DAL.Screen.BuildUrlForProductByCategory(new CmsBLL().Category_GetTitle(int.Parse("0" + Request.QueryString["cid"].ToString())), Request.QueryString["cid"].ToString(), CommonBLL.SiteID) + "\">" + new CmsBLL().Category_GetTitle(int.Parse("0" + Request.QueryString["cid"].ToString())) + "</a></li>\n");
            //    }
            //}
            //if (Request.QueryString["gid"] != null)
            //{
            //    if (Request.QueryString["nid"] != null)
            //    {
            //        Html.Append(
            //    "		<li><a href=\"" + DAL.Screen.BuildUrlForNewsByGroup(new CmsBLL().GroupNews_GetTitle(int.Parse("0" + Request.QueryString["gid"].ToString())), Request.QueryString["gid"].ToString(), CommonBLL.SiteID) + "\">" + new CmsBLL().GroupNews_GetTitle(int.Parse("0" + Request.QueryString["gid"].ToString())) + "</a></li>\n" +
            //    "		<li><a href=\"" + DAL.Screen.BuildUrlForNewsDetails(Request.QueryString["nid"].ToString(), new CmsBLL().News_GetTitle(int.Parse("0"+Request.QueryString["nid"].ToString())), Request.QueryString["gid"].ToString(), CommonBLL.SiteID) + "\">" + new CmsBLL().News_GetTitle(int.Parse("0"+Request.QueryString["nid"].ToString())) + "</a></li>\n");
            //    }
            //    else
            //    {
            //        Html.Append(
            //    "		<li><a href=\"" + DAL.Screen.BuildUrlForNewsByGroup(new CmsBLL().GroupNews_GetTitle(int.Parse("0" + Request.QueryString["gid"].ToString())), Request.QueryString["gid"].ToString(), CommonBLL.SiteID) + "\">" + new CmsBLL().GroupNews_GetTitle(int.Parse("0" + Request.QueryString["gid"].ToString())) + "</a></li>\n");
            //    }
            //}
            //if (Request.QueryString["sid"] != null)
            //{               
            //    Html.Append(
            //    "		<li><a href=\"" + DAL.Screen.BuildUrlForNewsStatic(new CmsBLL().StaticNews_GetTitle(int.Parse("0" + Request.QueryString["sid"].ToString())), Request.QueryString["sid"].ToString(), CommonBLL.SiteID) + "\">" + new CmsBLL().StaticNews_GetTitle(int.Parse("0" + Request.QueryString["sid"].ToString())) + "</a></li>\n");                
            //}
            //if (CommonBLL.CheckPattern(Request.Url.LocalPath, CommonBLL.PatternUrlCart))
            //{
            //    Html.Append(
            //    "		<li><a href=\""+DAL.EnvInfo.MainPublicRoot+"cart.html\">Giỏ hàng của bạn</a></li>\n");                
            //}
            //if (Request.Url.LocalPath.Contains("search.aspx"))
            //{
            //    string key=string.Empty;
            //    if(Request.QueryString["key"]!=null)
            //    {
            //        key=Request.QueryString["key"].ToString();
            //    }
            //    Html.Append(
            //    "		<li><a href=\"javascript:void(0);\">Kết quả tìm kiếm với từ khóa: \""+key+"\"</a></li>\n");
            //}
            //Html.Append(
            //     "	</ul>\n" +
            //     "</div>\n");
            ltbreadcrumb.Text = Html.ToString();
                               
        }

    }    
}